const TT_USERPHOTO = 'TT_USERPHOTO'
const TT_USERNAME = 'TT_USERNAME'
export default {
  state: {
    // 用户头像
    photo: localStorage.getItem(TT_USERPHOTO) || '',
    name: localStorage.getItem(TT_USERNAME) || ''
  },
  getters: {
    photo: state => {
      return state.photo
    },
    name: state => {
      return state.name
    }
  },
  mutations: {
    setUserPhoto (state, payload) { // 修改用户头像
      state.photo = payload
      localStorage.setItem(TT_USERPHOTO, payload)
    },
    setUserName (state, payload) { // 修改用户名字
      state.name = payload
      localStorage.setItem(TT_USERNAME, payload)
    }
  },
  actions: {

  }
}
